<template>
	<view class="waitingList_container">
		<view class="" style="height: 160rpx;">
		<view class="mail_List fixed z_ninetynine">
			<view class="mail" style="font-weight: 700;">
				<view class="order">巡更详情</view>
			</view>
		</view>
		<view class="icon fixed z_ninetynine">
			<u-icon name="arrow-left" color="#fefefe" size="40" @click="navigateBack"></u-icon>
		</view>
			
		</view>
		<!-- 报事人信息 -->
		<view class="data_Statistics" style="padding: 44rpx 24rpx 0 ;">
			<text style="font-weight: 700; font-size: 30rpx; color: #c4c4c4;">丨</text><text
				style="font-weight: 700; font-size: 30rpx;">执行信息</text>
		</view>
		<view class="card" style="padding: 0 42rpx;">
			<u-form :model="form" ref="uForm">
				<u-form-item label="执行人:">
					<u-input v-model="form.Reporter"
						placeholder-style="color: #000; text-align: right; font-weight: 600;" :placeholder="particulars.staffName"
						:clearable="false" :disabled="true" />
				</u-form-item>
				<u-form-item label="执行状态:">
					<u-input v-model="form.address"
						placeholder-style="color: #000; text-align: right; font-weight: 600;" placeholder="待接单"
						:clearable="false" :disabled="true" v-if="particulars.patrolStatus=='0'" />
						<u-input v-model="form.address"
							placeholder-style="color: #000; text-align: right; font-weight: 600;" placeholder="待执行"
							:clearable="false" :disabled="true" v-if="particulars.patrolStatus=='1'" />
							<u-input v-model="form.address"
								placeholder-style="color: #000; text-align: right; font-weight: 600;" placeholder="完成"
								:clearable="false" :disabled="true" v-if="particulars.patrolStatus=='2'" />
								<u-input v-model="form.address"
									placeholder-style="color: #000; text-align: right; font-weight: 600;" placeholder="超时完成"
									:clearable="false" :disabled="true" v-if="particulars.patrolStatus=='3'" />
				</u-form-item>
			</u-form>
		</view>
		<!-- 巡更信息 -->
		<view class="data_Statistics" style="padding: 28rpx 24rpx 0 ;">
			<text style="font-weight: 700; font-size: 30rpx; color: #c4c4c4;">丨</text><text
				style="font-weight: 700; font-size: 30rpx;">巡更信息</text>
		</view>
		<view class="card" style="padding: 0 42rpx;">
			<u-form :model="form" ref="uForm">
				<u-form-item label="巡更路线名称:">
					<u-input v-model="form.Reporter"
						placeholder-style="color: #000; text-align: right; font-weight: 600;" :placeholder="particulars.patrolName"
						:clearable="false" :disabled="true" />
				</u-form-item>
				<u-form-item label="路线有效时间:">
					<u-input v-model="form.address"
						placeholder-style="color: #000; text-align: right; font-weight: 600;"
						:placeholder="particulars.beginTime+': 00 :00'" :clearable="false" :disabled="true" />
				</u-form-item>
				<u-form-item label="路线失效时间:">
					<u-input v-model="form.address"
						placeholder-style="color: #000; text-align: right; font-weight: 600;"
						:placeholder="particulars.endTime+': 00 :00'" :clearable="false" :disabled="true" />
				</u-form-item>
				<!-- <u-form-item label="巡更频率:"> -->
				<view class="frequency">
					<text style="line-height: 67rpx;">巡更频率:</text>
					<u-input v-model="form.address"
						placeholder-style="color: #000; text-align: right; font-weight: 600;"
						:placeholder="particulars.duration+'分钟巡更一次，允许超时10分钟'" :clearable="false" :disabled="true" />
				</view>
				<!-- </u-form-item> -->
				<view class="" v-if="patrol_two">
					<u-input v-model="form.address" placeholder-style="color: #000; text-align: right; font-weight: 600;"
						:placeholder="beginTime+': 00: 00'+' 至 '+patrol_two+': 00: 00'" :clearable="false" :disabled="true" />
					<u-input v-model="form.address" placeholder-style="color: #000; text-align: right; font-weight: 600;"
						:placeholder="patrol_two+': 00: 00'+' 至 '+endTime+': 00: 00'" :clearable="false" :disabled="true" />
				</view>
				<view class="" v-if="patrol_three">
					<u-input v-model="form.address" placeholder-style="color: #000; text-align: right; font-weight: 600;"
						:placeholder="beginTime+': 00: 00'+' 至 '+patrol_three+': 30: 00'" :clearable="false" :disabled="true" />
					<u-input v-model="form.address" placeholder-style="color: #000; text-align: right; font-weight: 600;"
						:placeholder="patrol_three+': 30: 00'+' 至 '+endTime+': 00: 00'" :clearable="false" :disabled="true" />
				</view>
				<view class="example">
					<text style="font-size: 24rpx;flex: 1; color: #ccc;">例如:</text>
					<view style="flex: 6;font-size: 24rpx; color: #ccc;">60分钟巡更一次，允许超时10分钟，即巡更总时长为60分钟,前50分钟为正常，后10分钟为超时
					</view>
				</view>
<!-- 				<u-form-item label="打卡规则:">
					<u-input v-model="form.address"
						placeholder-style="color: #000; text-align: right; font-weight: 600;" :placeholder="particulars.patrolStatus=='1'? '顺序' : '无序'"
						:clearable="false" :disabled="true" />
				</u-form-item> -->
			</u-form>
		</view>
		<!-- 巡更路线信息 -->
		<!-- <routeInformation></routeInformation> -->
		<view class="data_Statistics" style="padding: 28rpx 24rpx 0 ;">
			<text style="font-weight: 700; font-size: 30rpx; color: #c4c4c4;">丨</text><text
				style="font-weight: 700; font-size: 30rpx;">巡更路线信息</text>
		</view>
		<view class="card" style="position: relative; padding: 0 42rpx;">
			<u-form :model="form" ref="uForm">
				<!-- 巡更点1 -->
				<u-form-item :label="particulars.dotName" label-position="top">
					<view class="name" style="display: flex;">
						<text>巡点名称: </text>
						<u-input v-model="form.dotName" placeholder-style="color: #000; margin-left: 20rpx; "
							:placeholder="particulars.dotName" :clearable="false" :disabled="true" />
					</view>
<!-- 					<view class="position" style="display: flex;">
						<text>蓝牙位置: </text>
						<u-input v-model="form.describe" placeholder-style="color: #000; margin-left: 20rpx; "
							:placeholder="particulars.content" :clearable="false" :disabled="true" style="flex: 2;" />
					</view> -->
					<view class="points" style="display: flex;">
						<text>巡更要点: </text>
						<view class="main" style="margin-left: 20rpx; flex: 2;">
							<u-input v-model="form.describe" placeholder-style="color: #000;  "
								:placeholder="particulars.content" :clearable="false" :disabled="true" />
<!-- 								<u-input v-model="form.describe" placeholder-style="color: #000;  "
									placeholder="访春园Y20#-1单元门口围栏是否破损" :clearable="false" :disabled="true" /> -->
<!-- 							<u-input v-model="form.describe" placeholder-style="color: #000; "
								placeholder="2、访春园Y20#-1单元门口围栏是否破损" :clearable="false" :disabled="true" />
							<u-input v-model="form.describe" placeholder-style="color: #000; "
								placeholder="3、访春园Y20#-1单元门口植物是否伸出" :clearable="false" :disabled="true" /> -->
						</view>
					</view>
				</u-form-item>
				<!-- 巡更点2 -->
<!-- 				<u-form-item label="巡更点2:" label-position="top">
					<view class="name" style="display: flex;">
						<text>巡点名称: </text>
						<u-input v-model="form.describe" placeholder-style="color: #000; margin-left: 20rpx; "
							placeholder="访春园Y20#-1单元门禁" :clearable="false" :disabled="true" />
					</view>
					<view class="position" style="display: flex;">
						<text>蓝牙位置: </text>
						<u-input v-model="form.describe" placeholder-style="color: #000; margin-left: 20rpx; "
							placeholder="访春园Y20#-1单元玄关处" :clearable="false" :disabled="true" style="flex: 2;" />
					</view>
					<view class="points" style="display: flex;">
						<text>巡更要点: </text>
						<view class="main" style="margin-left: 20rpx; flex: 2;">
							<u-input v-model="form.describe" placeholder-style="color: #000;  "
								placeholder="1、访春园Y20#-1单元门口是否清洁干净" :clearable="false" :disabled="true" />
							<u-input v-model="form.describe" placeholder-style="color: #000; "
								placeholder="2、访春园Y20#-1单元门口围栏是否破损" :clearable="false" :disabled="true" />
							<u-input v-model="form.describe" placeholder-style="color: #000; "
								placeholder="3、访春园Y20#-1单元门口植物是否伸出" :clearable="false" :disabled="true" />
						</view>
					</view>
				</u-form-item> -->
			</u-form>
		</view>
		<view class="button">
			<u-button type="primary" style="flex: 1;" @click="resolved">提醒</u-button>
			<u-button type="success" style="flex: 1;" @click="Approved">转交</u-button>
		</view>
		<u-popup v-model="show" mode="center" width="626rpx" height="430rpx" border-radius="20">
			<view
				style="height: 54rpx; line-height: 54rpx; font-weight: 600; color: #a1a1a1; background-color: #fbfbfb; text-align: center;">
				工单提示</view>
			<view class="work_Order">
				<view class="work_Order_top"></view>
				<view class="work_Order_bottom" style="margin-top: 10rpx;">催促工单成功！</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	import routeInformation from "@/components/routeInformation/routeInformation.vue"
	export default {
		components:{
			routeInformation
		},
		data() {
			return {
				// form表单
				form: {
					Reporter: '',
					title: '',
					address: '',
					describe: '',
					chargePerson: '',
					Executor: '',
					Maintenance: '',
					end: ''
				},
				// 演示地址，请勿直接使用
				action: 'http://www.example.com/upload',
				show: false,
				// 待复查Id
				patrolId:'',
				// 车辆详情
				particulars:'',
				// 巡更频率
				patrol:'',
				// 不带小数点的巡更频率
				patrol_two:'',
				// 带小数点的巡更频率
				patrol_three:'',
				beginTime:'',
				endTime:''
			}
		},
		onLoad(val) {
			this.loginId = uni.getStorageSync("setModel")
			if(val.patrolId){
			this.patrolId=val.patrolId
				// 待复查详情
				this.getListVehicleByIds()
			}
			// this.loading()
		},
		methods: {
			// 待复查详情
			getListVehicleByIds() {
				// console.log('1111111111111111111111111111')
				this.$http.get('Patrol/getPatrolById',{patrolId:this.patrolId}).then(res => {
					this.particulars=res.data
					let beginTime =parseFloat(res.data.beginTime.substring(11))
					let endTime =parseFloat(res.data.endTime.substring(11))
					let patrol = (beginTime + endTime)/2
					this.beginTime=res.data.beginTime.substring(11)
					this.endTime=res.data.endTime.substring(11)
					this.patrol = patrol.toString()
					// console.log(beginTime)
					// console.log(endTime)
					// console.log(this.patrol,'---------------------------')
					let self = this
					// debugger
					if(self.patrol.length=='1') {
						// console.log('selfselfselfselfselfselfselfselfselfself')
						self.patrol_two='0' + self.patrol
						// console.log(self.patrol_two)
						
					} else if (self.patrol.indexOf(".")!='-1') {
						console.log('selfselfselfselfselfselfselfselfselfself')
						if(self.patrol.length=='3') {
							this.patrol_three='0' +parseInt(self.patrol)
						} else {
							this.patrol_three=parseInt(self.patrol)
						}
						// console.log(self.patrol_three)
					} else {
						self.patrol_two=self.patrol
					}
					console.log(res)
					// this.owners = res.data
				})
			},
			resolved() {
				this.show = true
			},
			Approved() {}
		}
	}
</script>

<style lang="scss" scoped>
	.waitingList_container {
		.mail_List {
			overflow: hidden;
			width: 100%;
			background-color: #f2f2f2;

			.mail {
				padding: 10rpx 0;
				// margin-top: 96rpx;
				color: #999999;
				font-size: 40rpx;
				background-color: #e5e5e5;
			}

			.order {
				text-align: center;
			}
		}

		/deep/.card {
			.u-form-item--left {
				flex: unset !important;
				width: unset !important;
			}

			.frequency {
				display: flex;

				// justify-content: space-between;
				u-input {
					flex: 2;
				}
			}

			.example {
				display: flex;
				margin-left: 67rpx;
			}

			.u-form-item--right {
				margin-left: 31rpx;
			}
		}

		.icon {
			position: absolute;
			top: 18rpx;
			// top: 114rpx;
			left: 20rpx;
		}

		.second_card {
			.u-cell {
				padding: 18rpx 32rpx;

				/deep/.u-cell__value {
					color: #333333;
					font-weight: 600;
				}
			}

			/deep/.uni-card__content {
				padding: 16rpx 24rpx;
			}
		}

		/deep/button {
			border-radius: unset !important;
		}

		.uni-border[data-v-19622063]:after {
			border: unset;
		}

		/deep/.uni-border.data-v-19622063:after {
			border: unset;
		}

		.slot-btn__hover {
			background-color: rgb(235, 236, 238);
		}

		.button {
			display: flex;
			// position: fixed;
			// left: 0;
			// right: 0;
			// bottom: 0;
			margin-top: 200rpx;
			border-radius: 14rpx;
			overflow: hidden;
			z-index: 9;

			.u-btn {
				border-radius: unset;
			}
		}

		.work_Order {
			margin-top: 60rpx;
			text-align: center;

			.work_Order_top {
				width: 168rpx;
				height: 168rpx;
				margin: 0 auto;
				background-color: #e5e5e5;
				border-radius: 50%;
			}
		}
	}
</style>
